package com.sixks.app.domain.sku;

import java.util.ArrayList;
import java.util.List;

/**
 * @author colin
 * @date: 16/03/2014
 * @time: 13:24
 */
public class Product {

    private int id;
    //各种型号
    private List<ClothesSKU> sSize = new ArrayList<ClothesSKU>();
    private List<ClothesSKU> mSize = new ArrayList<ClothesSKU>();
    private List<ClothesSKU> lSize = new ArrayList<ClothesSKU>();
    private List<ClothesSKU> oSize = new ArrayList<ClothesSKU>();
    //商品图片
    private String urlOfImage;

    public int getId() {

        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<ClothesSKU> getsSize() {
        return sSize;
    }

    public List<ClothesSKU> getmSize() {
        return mSize;
    }

    public List<ClothesSKU> getlSize() {
        return lSize;
    }

    public List<ClothesSKU> getoSize() {
        return oSize;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Product)) return false;

        Product product = (Product) o;

        if (id != product.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id;
    }

    public void addSKU(ClothesSKU each) {
        if (each.getAttr().startsWith("size:S")) {
            this.sSize.add(each);
        } else if (each.getAttr().startsWith("size:M")) {
            this.mSize.add(each);
        } else if (each.getAttr().startsWith("size:L")) {
            this.lSize.add(each);
        } else {
            this.oSize.add(each);
        }
        this.urlOfImage = each.getImage();
    }

    public String getUrlOfImage() {
        return urlOfImage;
    }

    public void setUrlOfImage(String urlOfImage) {
        this.urlOfImage = urlOfImage;
    }

    @Override
    public String toString() {
        return "Product{" +
                "id=" + id +
                '}';
    }

}
